//
//  ZXShareViewController.m
//  MortgageHelper
//
//  Created by zhangxiang on 16/12/21.
//  Copyright © 2016年 zhangxiang. All rights reserved.
//

#import "ZXShareViewController.h"


@interface ZXShareViewController ()

@property (weak, nonatomic) IBOutlet NSLayoutConstraint *shareView_Bottom_space;


@end

@implementation ZXShareViewController

- (void)awakeFromNib {
    
    [super awakeFromNib];
    
    self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.6];
    
}

-(void)customInit{

    UITapGestureRecognizer *tap=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(removeself)];
    [self addGestureRecognizer:tap];
    
    self.alpha = 0.1;
    _shareView_Bottom_space.constant=-80;
    [UIView animateWithDuration:0.3 animations:^{
        _shareView_Bottom_space.constant=0;
        self.alpha = 1;
        [self layoutIfNeeded];
        [self setNeedsLayout];
    } completion:^(BOOL finished) {
        
    }];
}



-(void)removeself{
    
    [UIView animateWithDuration:0.3 animations:^{
        self.alpha = 0.1;
        _shareView_Bottom_space.constant=-80;
        [self layoutIfNeeded];
        [self setNeedsLayout];

    } completion:^(BOOL finished) {
        [self removeFromSuperview];
    }];

}


- (IBAction)tapActionToShare:(UIButton *)sender {
    
    if (sender.tag==0) {
        if (_retrunTypeBlock) {
            _retrunTypeBlock(sender.tag);
        }
    }{
        if (_retrunTypeBlock) {
            _retrunTypeBlock(sender.tag);
        }
    }
    
    [self removeself];

    
}


@end
